package com.yuan.Controller.user;


import com.yuan.Service.CategoryService;
import com.yuan.entity.Category;
import com.yuan.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController(value = "u-CategoryController")
@RequestMapping("/user/category")
@Slf4j
@Tag(name = "c端-分类接口")
@RequiredArgsConstructor
public class CategoryController {


    private final CategoryService categoryService;


    //查询分类
    @GetMapping("/list")
    @Operation(description = "查询分类")
    public Result<List<Category>> list( Integer type) {

        List<Category> list = categoryService.listSelf(type);

        return Result.success(list);
    }


}
